Skip to content

Conversation

Sunjae95
Copy link
Member

@Sunjae95 Sunjae95 commented Oct 16, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@Sunjae95 Sunjae95 requested a review from haklee October 16, 2024 01:47
@Sunjae95 Sunjae95 self-assigned this Oct 16, 2024
@github-actions github-actions bot added the js label Oct 16, 2024
@Sunjae95 Sunjae95 marked this pull request as ready for review October 16, 2024 05:02
@Sunjae95 Sunjae95 requested a review from a team as a code owner October 16, 2024 05:02
* brainstorming:
* preorder traverse
*
* n = length of root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 length of root은 무엇을 의미하는 것일까요?

Copy link
Contributor

@HC-kang HC-kang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코멘트를 써두고 제출을 안했었네요..

const dfs = (current) => {
const linkedNode = graph.get(current);

if (memo[current] || !linkedNode || linkedNode.length === 0) return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 옵셔널 체이닝을 사용하시면 조금 더 간결해질 것 같아요!
if (memo[current] || linkedNode?.length){ ... }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 그렇네요🙌

* brainstorming:
* preorder traverse
*
* n = length of root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

length of root는 전체 노드의 수를 말씀하시는걸까요?

@@ -0,0 +1,43 @@
/**
* @description
* queue의 특성을 활용하여 풀이
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분에 대해서 혹시 추가 설명을 요청드려도 될까요?

* space complexity: O(p)
*/
var canFinish = function (numCourses, prerequisites) {
const memo = Array.from({ length: numCourses + 1 }, () => false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와 처음에는 메모가 과연 효과가 있을까..? 생각했는데 몇번을 돌려도 Beats 100%네요 👍

image

Copy link
Contributor

@haklee haklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨습니다!

const dfs = (current) => {
const linkedNode = graph.get(current);

if (memo[current] || !linkedNode || linkedNode.length === 0) return true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 그렇네요🙌

Comment on lines +32 to +38
if (answer === null) {
answer = lists[minIndex];
tail = answer;
} else {
tail.next = lists[minIndex];
tail = lists[minIndex];
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HC-kang
매번 lists의 각 lists의 head중 가장 작은 index의 head를 바꿔주는방법이 queue의 선입선출을 연상되어서 적었습니다. 🙂

@Sunjae95
Copy link
Member Author

@haklee @HC-kang
전체 노드의 수를 의미합니다. root의 길이로 표현해서 혼선이 있었네요. 😅

@Sunjae95 Sunjae95 merged commit afb1e8a into DaleStudy:main Oct 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants